module.exports = {
  root: true,
  extends: [
    "stylelint-config-standard",
    "stylelint-config-css-modules",
    "stylelint-config-html/html",
    "stylelint-config-prettier"
  ],
  plugins: ["stylelint-scss"],
  // all rules can be see: https://github.com/stylelint/stylelint/blob/8a4253a56b683c32b127a612383372bb86ca99fc/docs/user-guide/rules/list.md
  rules: {
    "selector-pseudo-class-no-unknown": [
      true,
      {
        ignorePseudoClasses: ["global"]
      }
    ],
    "selector-pseudo-element-no-unknown": [
      true,
      {
        ignorePseudoElements: ["v-deep"]
      }
    ],
    "selector-type-no-unknown": [
      true,
      {
        ignoreTypes: ["page"]
      }
    ],
    "shorthand-property-no-redundant-values": true,
    "string-quotes": "double",
    // 屏蔽原生未知规则检查
    "at-rule-no-unknown": [
      true,
      {
        ignoreAtRules: [
          "tailwind",
          "apply",
          "variants",
          "responsive",
          "screen",
          "function",
          "if",
          "each",
          "include",
          "mixin",
          "return",
          "else"
        ]
      }
    ],
    "no-empty-source": null,
    "no-descending-specificity": null,
    // 允许font-family缺少泛型系列
    "font-family-no-missing-generic-family-keyword": null,
    "declaration-colon-space-after": "always-single-line",
    "declaration-colon-space-before": "never",
    // 'declaration-block-trailing-semicolon': 'always',
    "rule-empty-line-before": [
      "always",
      {
        ignore: ["after-comment", "first-nested"]
      }
    ],
    "unit-no-unknown": [true, { ignoreUnits: ["rpx", "PX", "Px", "pX"] }],
    // 关闭没有供应商前缀限制
    "value-no-vendor-prefix": null,
    // id选择器最多嵌套层数
    "selector-max-id": 1,
    // 最多空行
    "max-empty-lines": 3,
    // 选择器列表多行时，在逗号后面总是新行
    "selector-list-comma-newline-after": "always-multi-line",
    // 关闭指定类名格式
    "selector-class-pattern": null,
    "color-hex-case": [
      "lower",
      {
        message: "Lowercase letters are easier to distinguish from numbers"
      }
    ],
    // 代码块中最后一项声明的分号限制，在jsx语法style属性中和eslint冲突
    "declaration-block-trailing-semicolon": null,
    // 小数前导0
    "number-leading-zero": "always",
    "block-opening-brace-space-after": "always-single-line",
    "block-opening-brace-space-before": "always-single-line",
    "unit-case": null,
    "color-hex-length": "long",
    // 禁止无效十六进制
    "color-no-invalid-hex": true,
    // Disallow invalid named grid areas
    "named-grid-areas-no-invalid": null,
    "color-function-notation": null,
    "alpha-value-notation": "number",
    "no-duplicate-selectors": null,
    "declaration-block-no-duplicate-properties": null
  },
  overrides: [
    {
      files: ["src/**/*.scss"],
      customSyntax: "postcss-scss",
      rules: {
        // 别打开缩进会有问题
        indentation: null
      }
    }
  ]
}
